//
//  ConsulationNewReplyCellModel.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/10/31.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "ConsulationNewReplyCellModel.h"

#import "ConsulationListData.h"

@interface ConsulationNewReplyCellModel()

@end

@implementation ConsulationNewReplyCellModel

- (instancetype)initWithData:(id)data cellHeight:(CGFloat)cellHeight
{
    self = [super init];
    if (self)
    {
        _data = data;
        
        /// cellHeight+2（2容错）
        _cellHeight = MHUIScaleValue(cellHeight)+2;
        
        @weakify(self);
        [[RACObserve(self, data) distinctUntilChanged] subscribeNext:^(id x)
        {
            @strongify(self);
            
            ConsulationListData* curData = x;
            
            self.ask = curData.title;
            self.answer = @"缺少参数";
            self.time = curData.addTime;
            self.name = curData.user.nickname;
            self.answerNum = HCStrFormat(@"%@个解答", curData.replyCount);
            self.headimg = curData.user.headimg;
        }];
    }
    
    return self;
}

@end
